package guava;

import com.google.common.base.Preconditions;

/**
 * @Author: DRevelation
 * @Date: 2021/8/16 11:20
 */
public class PreconditionsDemo {
    public static void main(String[] args) {

        String name = "abc";
        String msg = null;
        try {
            Preconditions.checkNotNull(name, "不能为空");
            Preconditions.checkArgument(name.length() > 5, "名称太短");
        } catch (Exception e) {
            msg = e.getMessage();
        }
        System.out.println(msg);
    }
}
